import sys
from jd_spider_requests import JdSeckill
from apscheduler.schedulers.blocking import BlockingScheduler

if __name__ == '__main__':
    title = """

       oooo oooooooooo.            .oooooo..o                     oooo         o8o  oooo  oooo  
       `888 `888'   `Y8b          d8P'    `Y8                     `888         `"'  `888  `888  
        888  888      888         Y88bo.       .ooooo.   .ooooo.   888  oooo  oooo   888   888  
        888  888      888          `"Y8888o.  d88' `88b d88' `"Y8  888 .8P'   `888   888   888  
        888  888      888 8888888      `"Y88b 888ooo888 888        888888.     888   888   888  
        888  888     d88'         oo     .d8P 888    .o 888   .o8  888 `88b.   888   888   888  
    .o. 88P o888bood8P'           8""88888P'  `Y8bod8P' `Y8bod8P' o888o o888o o888o o888o o888o 
    """
    print(title)
    scheduler = BlockingScheduler()
    jd_seckill = JdSeckill()
    jd_seckill.reserve()
    jd_seckill.seckill_by_proc_pool()
    # 定时任务预约 + 抢购
    scheduler.add_job(jd_seckill.reserve,
                      'cron',
                      day_of_week='1-5',
                      hour=8,
                      minute=30)
    scheduler.add_job(jd_seckill.seckill_by_proc_pool,
                      'cron',
                      day_of_week='1-5',
                      hour=9,
                      minute=58)
    scheduler.start()
